package w8;

public class ExceptionDemo {
	static void f(boolean haveException) throws Exception {
		System.out.println("start f()");
		if (haveException) {
			throw new Exception("有异常");
		}
		System.out.println("end f()");
	}

	public static void main(String[] args) {
		System.out.println("start main");
		try {
			System.out.println("start try");
			f(true);
			System.out.println("end try");
		} catch (Exception e) {
			System.out.println("catch excption");
		}
		System.out.println("end main");
	}
}
